
#新密码匹配
'''突然就开窍了感觉'''
import string
a = 'cdcaVSVS%#%+1'
c = '2312d32gtdb'

def t(m:str,length = 8)->int:
    if len(m)<length:
        return '抱歉，您的密码不够八位'
    elif m[0] not in set(string.ascii_letters+'_'):
        return '抱歉，您的密码应以字母或下划线开头'
    table = [set(v) for v in [string.digits, string.ascii_uppercase,  string.ascii_lowercase, string.punctuation]]
    p = 0
    for i in range(4):
        if set(m)&table[i]:
            p+=1
    return p
b = t(a)
print(t(c))
